package com.evil.common.application.dto.button;

import com.evil.common.application.dto.SourceDTO;
import com.evil.common.application.enums.button.ButtonSourceTypeEnum;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 按钮源类型
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ButtonSourceDTO extends SourceDTO {

    /**
     * 版本
     */
    @NotNull(message = "version not null")
    private Integer version;

    /**
     * 列表页展示(0:关闭, 1:开)
     */
    private Integer inTable;

    /**
     * 详情页展示(0:关闭, 1:开)
     */
    private Integer inDetail;

    public ButtonSourceDTO(@NotNull(message = "源类型不能为空") Integer sourceType, @NotNull(message = "源id不能为空") Long sourceId, Integer version) {
        super(sourceType, sourceId);
        this.version = version;
    }

    public ButtonSourceDTO(ButtonSourceTypeEnum buttonSourceTypeEnum, @NotNull(message = "源id不能为空") Long sourceId) {
        super(buttonSourceTypeEnum.getId(), sourceId);
    }

    public ButtonSourceDTO(ButtonSourceTypeEnum buttonSourceTypeEnum, @NotNull(message = "源id不能为空") Long sourceId, Integer version) {
        super(buttonSourceTypeEnum.getId(), sourceId);
        this.version = version;
    }
}
